﻿using Coldairarrow.Business.BackStage.Abstracts;
using Coldairarrow.Entity.BackStage.Abstracts;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Coldairarrow.Api.Controllers.BackStage.Abstracts
{
    [Route("/BackStage/Abstracts/[controller]/[action]")]
    public class BS_AbstractsController : BaseApiController
    {
        #region DI

        public BS_AbstractsController(IBS_AbstractsBusiness bS_AbstractsBus)
        {
            _bS_AbstractsBus = bS_AbstractsBus;
        }

        IBS_AbstractsBusiness _bS_AbstractsBus { get; }

        #endregion

        #region 获取

        /// <summary>
        /// 后台——获取注册协议
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public BS_Abstracts GetZCXYData()
        {
            return _bS_AbstractsBus.GetZCXYDataAsync();
        }

        /// <summary>
        /// 后台——获取积分规则
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public BS_Abstracts GetJFGZDat()
        {
            return _bS_AbstractsBus.GetJFGZDataAsync();
        }

        /// <summary>
        /// 后台——获取收益说明
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public BS_Abstracts GetSYSMData()
        {
            return _bS_AbstractsBus.GetSYSMDataAsync();
        }

        /// <summary>
        /// 后台——获取体现说明
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public BS_Abstracts GetTXSMDat()
        {
            return _bS_AbstractsBus.GetTXSMDataAsync();
        }

        #endregion

        #region 提交
        /// <summary>
        /// 后台——设置注册协议
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task SaveZCXYData(BS_Abstracts data)
        {
            data.Type = 0;
            await _bS_AbstractsBus.AddOrUpdateZCXYData(data);
        }

        /// <summary>
        /// 后台——设置积分规则说明
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task SaveJFGZData(BS_Abstracts data)
        {
            data.Type = 1;
            await _bS_AbstractsBus.AddOrUpdateJFGZData(data);
        }

        /// <summary>
        /// 后台——设置积分规则说明
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task SaveSYSMData(BS_Abstracts data)
        {
            data.Type = 2;
            await _bS_AbstractsBus.AddOrUpdateSYSMData(data);
        }

        /// <summary>
        /// 后台——设置提现规则说明
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task SaveTXSMData(BS_Abstracts data)
        {
            data.Type = 3;
            await _bS_AbstractsBus.AddOrUpdateTXSMData(data);
        }

        #endregion
    }
}